<?php
require_once __DIR__.'/Config/config.php';
require_once __DIR__.'/common/util.php';
/**
 * auto load
 * @param string $className
 */
function __autoload($className) {
	$ext = ".php";
// 	$path = __DIR__;
// 	$path = $path.'/../lib';
	$path = __DIR__;
	$className = str_replace("_" , DIRECTORY_SEPARATOR, $className);
	$filename = $path . DIRECTORY_SEPARATOR . $className;
	//echo "<br />" . $filename;
	if (is_readable($filename . $ext)) {
		//echo "<br /> loaded" . $filename;
		require_once $filename . $ext;
	}
}

function handleError($errno, $errstr, $errfile, $errline, array $errcontext)
{
	// error was suppressed with the @-operator
	if (0 === error_reporting()) {
		return false;
	}

	throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler('handleError');